import logging,yagmail
import time

import HTMLTestRunner_PY3
from HTMLTestRunner_PY3 import HTMLTestRunner


def Log():
    t=time.strftime('%Y%m%d%H%M%S',time.localtime())
    logging.basicConfig(filename='yklog'+t+'.log',filemode='a+',
                        level=logging.INFO,
                        format='%(asctime)s %(message)s %(filename)s %(lineno)s %(levelname)s')


def Report():
    t = time.strftime('%Y%m%d%H%M%S', time.localtime())
    oo = HTMLTestRunner_PY3.HTMLTestRunner(open('baogao'+t+'.html','wb'),title='这是酒仙网的测试报告',description='酒仙网测试')
    return oo



def Email():
    t = time.strftime('%Y%m%d%H%M%S', time.localtime())
    email=yagmail.SMTP(user='1522057104@qq.com',password='mhszldzvffpnjfcc',host='smtp.qq.com',port=465)
    email.send(to='1522057104@qq.com',subject='这是酒仙网测试',contents=['yklog'+t+'.log','baogao'+t+'.html'])
